package com.gitee.ywj1352.kafka;


import io.micrometer.core.instrument.MeterRegistry;
import com.gitee.ywj1352.kafka.producer.YWJKafkaProducer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;

@SpringBootApplication
public class SpringKafkaApp {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringKafkaApp.class, args);
        YWJKafkaProducer producer = context.getBean(YWJKafkaProducer.class);
        producer.sendMessage();
    }
    @Bean
    MeterRegistryCustomizer<MeterRegistry> configurer(
            @Value("${spring.application.name}") String applicationName) {
        return (registry) -> registry.config().commonTags("application", applicationName);
    }
}
